package com.xiaoxi.open.design.creation.builderpattern.builder;

import com.xiaoxi.open.design.creation.builderpattern.domain.MyDomain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author xiaoxi
 * @ProjectName creation_pattern
 * @PackageName com.xiaoxi.open.design.creation.builderpattern.builder
 * @ClassName MarkDownBuilder
 * @Description TODO
 * @Date 2024/5/14 10:51
 * @Version 1.0
 */
@Service
@Slf4j
public class MarkDownBuilder implements IBuilder {
    @Override
    public void open() {
    }

    @Override
    public void buildTitle(String str) {
        System.out.println("# " + str);
        System.out.println();
    }

    @Override
    public void buildString(String str) {
        System.out.println(str);
    }

    @Override
    public void buildTray(List<MyDomain> myDomainList) {
        for (MyDomain myDomain : myDomainList) {
            System.out.println(" - [" + myDomain.getContent() + "](" + myDomain.getUrl() + ")");
        }
        System.out.println();
    }


    @Override
    public void close() {

    }
}
